#include<iostream>
#include<cmath>
using namespace std;
double pow(double b,double n);
int f(int x, int y);
int  main()
{int B,N,k;double n;
 while(cin>>B>>N)
 { if(B==0&&N==0) break;
   n=1.0/N;
   k=(int)pow(B,n);
   cout<<((B-f(k,N))>(f(k+1,N)-B)?k+1:k)<<endl;
 }
 system("pause");
 return 0;
}


int f(int x,int y) 
{int sum=1;
 for(int j=1;j<=y;j++)
   sum=sum*x;
 return sum;
}
